package com.rr.easy;

/**
 * @author zhuangcanrun
 * @Date 2021/12/01/0:21
 * @description
 **/
/*
* https://leetcode-cn.com/problems/consecutive-characters/
* */
public class MaxPower {
    public int maxPower(String s) {
        int ans = 1;
        int length = s.length();
        char startChar = s.charAt(0);
        int tempAns = 1;
        for (int i = 1; i < length; i++) {
            char currentChar = s.charAt(i);
            if (startChar == currentChar) {
                tempAns++;
            }
            if (startChar != currentChar || i == length - 1) {
                ans = Math.max(ans, tempAns);
                startChar = currentChar;
                tempAns = 1;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        MaxPower maxPower = new MaxPower();
        System.out.println(maxPower.maxPower("leetcoddddddddeeeee"));
    }
}
